#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef int I;
typedef long long LL;
const I N = 1e5 + 10;
I n,r[N],p[N];
I main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(I i = 1;i <= n;i++){
        scanf("%d",&r[i]);
    }
    sort(r + 1,r + n + 1);
    for(I i = 1;i <= n;i++){
        if(r[n] > r[i]){
            p[i] = upper_bound(r + 1,r + n + 1,r[i]) - r;
        }else{
            p[i] = n + 1;
        }
        //printf("%d\n",p[i]);
    }
    I pos = 0;
    for(I i = 1;i <= n;i++){
        pos = max(pos + 1,p[i]);
        if(pos == n + 1){
            printf("%d\n",n - i + 1);
            return 0;
        }
    }
    return 0;
}
